package com.aixx.springcloud.alibaba.controller;

import com.aixx.springcloud.alibaba.domain.CommonResult;
import com.aixx.springcloud.alibaba.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @author shkstart
 * @create 2021-02-18 14:53
 */

@RestController
public class AccountController {

     @Autowired
     private AccountService accountService;


      @PostMapping("account/decrease")
     CommonResult  decrease(@RequestParam("userId")Long userid ,
                            @RequestParam("money") BigDecimal money){

         accountService.decrease(userid, money);
         return new CommonResult(200,"扣款成功 ");
     }
}
